{% extends "common.html" %}
{% load remainder %}

{% block subtitle_main %}
{% url 'product_view' as product_url %}
    <h3>{{localnav.name}}</h3>
    <ul>
        {% for type_obj in subtitle_lists %}
            {%if type_obj.id == local_subtitle.id %}
                <li class="active"><a href="{{product_url}}?type_id={{type_obj.id}}&nav_id={{localnav.id}}" target="_self">{{type_obj.name}}</a></li>
            {%else%}
                <li><a href="{{product_url}}?type_id={{type_obj.id}}&nav_id={{localnav.id}}" target="_self">{{type_obj.name}}</a></li>
            {%endif%}
        {% endfor %}
              {%block subtitle%} {% endblock %}
    </ul>
{% endblock %}



{% block subtitle_local %}
    <div class="c-m-t-path pull-right">当前位置：{{localnav.name}} > {{local_subtitle.name}} • 摩力顿</div>
    <h4>{{local_subtitle.name}}</h4>
{% endblock %}


{% block subtitle_content %}
    <div class="c-m-list">
        <ul>
        {% autoescape off %}
            {% for obj in page_obj.object_list %}
                {{ forloop.counter0 | get_remainder:"start, 3"}}
                        <div class="c-m-l-list hover_box">
                            <a href="{% url 'product_details' obj.id %}?nav_id={{localnav.id}}" target="_self">
                                <img src="{{obj.img.url}}" alt="{{obj.name}}"/>
                                <p>{{obj.name}}</p>
                            </a>
                        </div>
                {{ forloop.counter | get_remainder:"end, 3"}}
            {%endfor%}
        {% endautoescape %}
        </ul>
    </div>
    <div class="c-m-l-pagination">
        <ul>
            <li>共{{paginator.num_pages}}页记录</li>

            {% if page_obj.has_previous %}
                <li><a href="{{ request.path }}?&page={{ page_obj.previous_page_number }}" target="_self">上一页</a></li>
            {%else%}
                <li><a href="#" target="_self">上一页</a></li>
            {% endif %}

            {%for num in page_obj.paginator.page_range %}
                {%if num == page_obj.number %}
                    <li class="active"><a href="#" target="_self">{{num}}</a></li>
                {%else%}
                    <li><a href="{{ request.path }}?page={{ num }}&nav_id={{localnav.id}}" target="_self">{{num}}</a></li>
                {%endif%}
            {%endfor%}

            {% if page_obj.has_next %}
               <li> <a href="{{ request.path }}?page={{ page_obj.next_page_number }}&nav_id={{localnav.id}}" target="_self">下一页</a></li>
            {%else%}
               <li> <a href="#" target="_self">下一页</a></li>
            {% endif %}


        </ul>
    </div>
</div>
{% endblock %}
